/*
 * @Description: 按钮权限指令
 * @Author: zdq
 * @Date: 2024-11-25 20:47:31
 * @LastEditTime: 2024-11-26 00:18:20
 * @LastEditors: zdq
 * @Reference: 
 */
import { useUserStore } from '@/store/modules/user'
export default {
  mounted(el, binding, vnode) {
    const requiredPermission = binding.value;
    const user = useUserStore()
    const authorsCode = user.userInfo?.authorsCode || []
    if (!authorsCode.includes(requiredPermission)) {
      el.style.display = 'none'; // 如果没有权限，隐藏元素
      // 或者你可以选择禁用元素而不是隐藏
      // el.disabled = true;
    }
  }
};